"""
#!!===========================================================
#版权（C）2023, Huawei Technologies Co., HUTAF xDevice
#!!===========================================================
#用例编号:      Security_IAM_AuthWidget_Fingerprint_Auth_Func_0040
#用例名称:      单指纹认证取消
#用例作者:
#修改说明:
#!!===========================================================
"""

# -*- coding: utf-8 -*-
from devicetest.core.test_case import TestCase
from devicetest.aw.OpenHarmony import CommonOH
from aw.Useriam.AuthWidget import SecurityUserIamAuthWidgetDepend
from aw.Useriam.AuthWidget import SecurityUserIamAuthWidgetPinAuth
from aw.Useriam.AuthWidget import SecurityUserIamFingerPrintAuthApi



class Security_IAM_AuthWidget_Fingerprint_Auth_Func_0040(TestCase):

    def __init__(self, controllers):
        self.TAG = self.__class__.__name__
        self.tests = [
            "test_step1",
        ]
        TestCase.__init__(self, self.TAG, controllers)

    def test_step1(self):
        print("测试步骤1：测试hap拉起指纹认证")
        SecurityUserIamAuthWidgetDepend.widget(self.device1, "4", "10000", "指纹认证", "", "1")
        CommonOH.wait(self.device1, 1)
        print("测试步骤2：取消指纹认证")
        SecurityUserIamFingerPrintAuthApi.fingerprintAuth(self.device1, 1)
        print("检查点2：控件退出")
        CommonOH.checkIfTextExist(self.device1, "12500003", expect=False)

    def teardown(self):
        print("测试步骤1：测试hap拉起口令认证")
        SecurityUserIamAuthWidgetDepend.widget(self.device1, "1", "10000", "口令认证", "", "1")
        print("测试步骤2：使用正确口令认证")
        SecurityUserIamAuthWidgetPinAuth.PinAuth(self.device1, "111111", 0)
        print("检查点2：认证成功，控件退出")
        CommonOH.checkIfTextExist(self.device1, "12500000", expect=False)
